home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / Education / Drill Designer 1.0 / Drill Designer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-28  |  5.4 KB  |  138 lines  |  [TEXT/KAHL]

  1. #include <ctype.h>                /* Character class tests: isdigit, toupper, */
  2. #include <stdarg.h>                /* Variable length argument lists. */                
  3. #include <string.h>                /* String functions: strcat, strcpy, */
  4. #include <stdlib.h>                /* rand, RAND_MAX */
  5. #include <time.h>                /* Time utilities */
  6. #include <stdio.h>                /* File storage & retrieval */
  7.  
  8. typedef struct i_node *item_ptr;             
  9.  
  10. typedef struct i_node    
  11.         {    item_ptr             prev;
  12.             short                question_Num;
  13.             short                times_Missed;
  14.             short                times_Answered;
  15.             item_ptr            next;        
  16.         }                                                item_node;
  17.  
  18. #define                value                question_Num
  19. #define                MAX_SIZE            32766
  20. #define                AT_END                32767    
  21. #define                NO_ERROR              '\0'
  22. #define              MAX_ERROR_LENGTH     256
  23. #define                MAX_FILENAME_LENGTH    32
  24. #define                SET_TIME            1
  25. #define                DONT_SET            0
  26. #define                MEM_ERROR            "Ran out of memory\n"
  27. #define                INVALID_TARG_CHAR   "Invalid target list char, default set\n"
  28. #define                NO_INS_LIST            "No insert positions list, can't execute\n"
  29. #define                ITEM_TOO_LARGE        "Item larger than question pool size\n"
  30.  
  31.  
  32.  
  33. enum insert_Techniques
  34.     {    DII = 0,
  35.         RDII,
  36.         RDIns,
  37.         RDInt,
  38.         RFII,
  39.         EC
  40.     };
  41.  
  42.  
  43. typedef struct global_space        
  44.         {    short        insert_technique_Code;
  45.             short        smallest_Position;
  46.             short        fewest_Insertions;
  47.             short        num_to_Retire;
  48.             short        num_Retired;
  49.             short        max_item_Num;
  50.             item_ptr    incorrect_Head;
  51.             item_ptr    incorrect_Tail;
  52.             item_ptr    replenish_Head;
  53.             item_ptr    replenish_Tail;
  54.             item_ptr    future_queue_Head;
  55.             item_ptr    future_queue_Tail;
  56.             item_ptr    long_list_Head;
  57.             item_ptr    long_list_Tail;
  58.             item_ptr    retired_items_Head;
  59.             item_ptr    retired_items_Tail;
  60.             item_ptr    hard_list_Head;
  61.             item_ptr    hard_list_Tail;
  62.             item_ptr    resurrect_Ptr;
  63.             time_t        start_Time;
  64.             long        time_spent_Current;
  65.             long        time_spent_Previous;
  66.             short          questions_answered_Current;
  67.             short        questions_answered_Previous;
  68.             short        questions_correct_Current;
  69.             short        questions_correct_Previous;
  70.             char          error_Message [MAX_ERROR_LENGTH];
  71.  
  72.         }                                                    global_struct;
  73.  
  74. typedef struct global_space *global_ptr;
  75.  
  76. /* Declare toolbox routines used */
  77.  
  78.     extern pascal Ptr NewPtr (long);
  79.     extern pascal void DisposPtr (void *);
  80.  
  81. /* Prototypes for primary functions (in order of appearance) */
  82.     void         CreateDrill (global_ptr *ds_Handle, short num_of_Questions, short num_of_Repeats, 
  83.                              short question_pool_Size, char orientation_Char, 
  84.                              char *insert_Technique, char *incorrect_Positions, ...);
  85.     void        Store (global_ptr ds, char *student_ID, char *drill_ID, 
  86.                        char *author_Variables);
  87.     char *        Restore (global_ptr *ds_Handle, char *student_ID, char *drill_ID);
  88.     short        Next (global_ptr ds);    
  89.     void         Correct (global_ptr ds);
  90.     void        Incorrect (global_ptr ds);
  91.     void        Requeue (global_ptr ds, short item_Num, char *requeue_Positions, 
  92.                          char target_list_Char);
  93.     void        Purge (global_ptr ds, char *item_or_Pos, char target_list_Char);
  94.     void        Retire (global_ptr ds, short item_Num);
  95.     void        Insert (global_ptr ds, short item_Num, char *insert_Positions, 
  96.                         char target_list_Char);
  97.     void        Pad (global_ptr ds, char *pad_Str, char target_list_Char);
  98.  
  99.     long        RetrieveInfo (global_ptr ds, short info_Request, ...);
  100.     void         Dispose (global_ptr *ds_Handle);
  101.     char *        GetErrorMessage (global_ptr ds);
  102.  
  103. /* Prototypes for secondary functions (in order of appearance) */    
  104.     void        Add_to_FQ (global_ptr ds, short copy_Amount, char source_list_Char);
  105.     void        Build_Hard_List (global_ptr ds, short hard_list_Goal, char hard_list_Form,
  106.                                  char source_list_Char);                                
  107.     item_ptr     Check_Lists (global_ptr ds, short target_Item);
  108.     void        Copy_Node_Data (global_ptr ds, item_ptr source_Node, item_ptr target_Node);
  109.     void        Copy_List (global_ptr ds, item_ptr source_Head, 
  110.                            item_ptr *target_head_Handle, item_ptr *target_tail_Handle);
  111.     void        Define_Filename (global_ptr ds, char *student_ID, char *drill_ID, char *file_Name);
  112.     void        Dispose_Global_Space (global_ptr *ds_Handle);
  113.     void         Dispose_List (global_ptr ds, item_ptr *list_head_Handle, 
  114.                                    item_ptr *list_tail_Handle);
  115.     void        Dispose_Node (global_ptr ds, item_ptr node_Ptr, 
  116.                                    item_ptr *list_head_Handle, item_ptr *list_tail_Handle);                                
  117.     short        Encode_Insert_Technique (global_ptr ds, char *technique_Str);
  118.     item_ptr    First_Occurrence (global_ptr ds, short item_num, item_ptr list_Ptr);                            
  119.     short        Get_List_Length (global_ptr ds, item_ptr list_Ptr);
  120.     item_ptr    Get_Nth (global_ptr ds, short ds_N, item_ptr list_Ptr);
  121.     void         Get_Time (global_ptr ds, short ds_Set);
  122.     short        Greater_Than_Previous (global_ptr ds, item_ptr test_Node);
  123.     void         Insert_List (global_ptr ds, item_ptr ins_Node, item_ptr positions_Ptr,
  124.                              item_ptr *target_head_Handle, item_ptr *target_tail_Handle);
  125.     void        Insert_Node (global_ptr ds, item_ptr ins_Node, short ins_Pos, 
  126.                              item_ptr *list_head_Handle, item_ptr *list_tail_Handle);
  127.     void        Make_Global_Space (global_ptr *ds_Handle);
  128.     item_ptr    Make_Node (global_ptr ds);
  129.     short        Num_Occurrences (global_ptr ds, short item_Num, item_ptr list_Head);
  130.     void        Replenish (global_ptr ds);
  131.     void        Scramble_Long_List (global_ptr ds);    
  132.     void        Set_Lists (global_ptr ds, char *target_list_char_Ptr, 
  133.                            item_ptr **list_head_handle_Ptr, item_ptr **list_tail_handle_Ptr);    
  134.     short        Size_Needed (global_ptr ds, item_ptr list_Ptr);
  135.     void         Str_to_Linked_List (global_ptr ds, char *source_Str, item_ptr *list_Head_Handle, 
  136.                                     item_ptr *list_Tail_Handle, char *error_Tag);
  137.     void        Update (global_ptr ds, item_ptr update_List, item_ptr update_Node);
  138.